package org.atf.controller;

import java.util.Calendar;
import java.util.HashMap;

public class DashboardController {

	public HashMap<String, Long> getJVMRuntimeStats(){
		HashMap<String,Long> jvmStats= new HashMap<String,Long>();
		int mb = 1024*1024;	
		Runtime runtime = Runtime.getRuntime();
		long usedMemory=(runtime.totalMemory() - runtime.freeMemory()) / mb;
		long freeMemory=runtime.freeMemory() / mb;
		long totalMemory=runtime.totalMemory() / mb;
		long maxMemory=runtime.maxMemory() / mb;
		jvmStats.put("genTimeStamp",Calendar.getInstance().getTimeInMillis() );
		jvmStats.put("usedMemory", usedMemory);
		jvmStats.put("freeMemory", freeMemory);
		jvmStats.put("totalMemory", totalMemory);
		jvmStats.put("maxMemory", maxMemory);
		
		return jvmStats;
	}
}
